package com.company.genealogy.web.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.company.genealogy.web.entity.Spouse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 配偶信息 Mapper
 */
@Mapper
public interface SpouseMapper extends BaseMapper<Spouse> {
    @Select("SELECT * FROM tb_spouse WHERE name LIKE CONCAT('%', #{name}, '%')")
    List<Spouse> searchByName(@Param("name") String name);
    
    @Select("SELECT * FROM tb_spouse WHERE gender = #{gender}")
    List<Spouse> selectByGender(@Param("gender") String gender);
    
    @Select("SELECT * FROM tb_spouse WHERE status = #{status}")
    List<Spouse> selectByStatus(@Param("status") Integer status);
    
    @Select("SELECT * FROM tb_spouse ORDER BY created_at DESC")
    List<Spouse> selectAllOrderByCreatedAt();
} 